package com.yjd.bi.depository.dao.impl;

import com.yjd.comm.base.enums.DbWREnums;
import org.springframework.stereotype.Component;
import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import com.yjd.bi.depository.model.BasicDataDepoModel;
import com.yjd.bi.depository.dao.IBasicDataDepoDao;

import java.util.Map;

/**
 * <b>description</b>：银行存管数据统计数据访问层 <br>
 * <b>time</b>：2017-05-17 15:39:33 <br>
 * <b>author</b>： yangchangyan@yijiedai.com
 */
@Component("basicDataDepoDao")
public class BasicDataDepoDaoImpl extends BaseDaoImpl implements IBasicDataDepoDao {

	private static final String SQLMAPNAMESPACE = BasicDataDepoModel.class.getName();
	private static final String PKNAME = "id";

	@Override
	public String getPrimaryKeyName() {
		return PKNAME;
	}

	@Override
	public String getSqlmapNamespace() {
		return SQLMAPNAMESPACE;
	}

	@Override
	public BasicDataDepoModel countByDatePeriod(Map<Object, Object> map) throws Exception {
		return (BasicDataDepoModel)this.getSqlMap(DbWREnums.READ.isWrite())
				.queryForObject(
					this.getStatement("countByDatePeriod"),
					map);
	}

	@Override
	public int countDepoBankByYear(Map<Object, Object> map) throws Exception {
		return 	(Integer) this.getSqlMap(DbWREnums.READ.isWrite())
				.queryForObject(
						this.getStatement("countDepoBankByYear"),
						map);
	}
}
